package code.structure.module.test
{
	import com.patience.mvc.context.Command;
	
	import code.main.AppCommonData;
	import code.main.core.mvc.YController;
	import code.structure.module.configs.ConfigModel;
	import code.structure.module.task.data.TaskTestConfig;
	import code.structure.module.user.data.UserBaseData;
	import code.structure.module.user.data.UserData;
	import code.untils.CommandNameConst;
	
	/**
	 *测试控制器，这里模拟后台数据的返回 
	 * @author Yuri
	 * 
	 */
	public class TestController extends YController
	{
		private var _configModel:ConfigModel;
		
		public function TestController()
		{
			super();
		}
		
		override public function start():void{
			//用户数据
			startUserInfo();
			dispatch(new Command(CommandNameConst.COMMAND_READ_FRIENDSLIST));
			(_context.commonData as AppCommonData).taskModel.parserData(TaskTestConfig.dynamicData);
		}
		
		private function startUserInfo():void{
			_configModel = (_context.commonData as AppCommonData).configModel;
			var _userData:UserData = new UserData(dispatch,_configModel);
			var obj:Object = new Object();
			obj.id = '100004202706649';
			obj.level = 20;
			obj.exp = 2000;
			obj.coin = 2000;
			obj.diamond = 100;
			obj.energy = 30;
			obj.userName = 'qian';
			obj.manorname = "qian's estate";
			obj.magic = 100;
			_userData.analysisData(obj);
			_userData.userBaseData.levelConfigData = _configModel.analysisLevel.getlevelConfigDataById(_userData.userBaseData.uLevel);
			_userData.levelHelpHandler();
			//抛出解析完毕
			dispatch(new Command(CommandNameConst.COMMAND_USERDATA_ANALY_COMPLETE));
		}
	}
}